Ensuring the Safety of Reinforcement Learning Algorithms at Training and Deployment