Fixed incorrect if statement