Fixed tests which worked in browser but didn't in phantomjs.