fix erroneous exits