fixed bug with lingering event handlers not being cleaned up