some code cleanup
fix for unregistering eventlisters