Teaching AI systems to behave themselves