bugfixes for PhantomJS