fix system exit issue