fix annoying IE8 compat bugs, introduce compat.js