fixed a doubled if-statement