Fixed bug and compatibility with jQuery 1.9