fix unexpected exit