How the brain can learn to be safe again