fixed huge bug in checking