Fixed compatibility issues with jQuery 1.9 and above.