jQuery event ref error fixed