Fix bugs with phantomjs rendering