Issue #1631: Fixed a bug on removeEventListener

Bugfix for issue #1631 where removeEventListener would throw when no event listeners are registered on the object.