Some fixes for PhantomJS testing