tweaks to handle phantomjs restart conditions.