Fix bug which broke compatibility with jQuery <1.7