fixes if statement, several tests pass