Fix cleanup of event listeners