fixed code for phantomjs