Fix auto-termination issue