fixed bug in safetyCheck