Reversed order of if condition