Fixed logic errors in imageCheck.