implemented detach listener