fixed: broken checks
optimize two if conditions
Merge pull request #4664 from Montellese/broken_checks

fix broken comparisons