fixes problems in IE and phantomJS