Fix for duplicated event triggered when using ajax.