add some safeguards