if-clause bugfix