fix if statement, previous one did not work as expected