added safeguards