fix(phantom): make script more defensive for phantomjs