fixed bug in edge case of safetyCheck