fixed issue with removing event handlers