Add terminate check and alert