Fix problem in phantomjs with jQuery1.8+