add logging on termination