Fixes templatelistener removal.