bug fix in event listener removal