Fixed bind/unbind jQuery events for earlier versions compat and ensure that the event is removed at the correct moment