Changed debug check to something more logical