Fixing jquery event issues