Understanding Model-Based Reinforcement Learning And Its Application In Safe Reinforcement Learning