termination detection