fix termination issue