Some fixes for the sake of PhantomJS