Why is this if statement removed?