more bug-proof exit traversal