Fixed templatelistener removal