Combined fixes for jQuery scope robustness and jQuery 1.9.1