fixing bug of looping phantomjs