fix(headless): fix some bugs occuring in phantomjs and slimerjs on travis