moved the debug check