fix faulty else branch