Apply Ravi's changes to v1.9 of PhantomJS