Fixed the if-checks