Fix bugs with IE<9

Hi, I had some bugs with IE<9 and some incompatibility with functions used. Commits messages explain what have been done.

Feel free to cherry pick or rewrite those if it don't fit your naming/styling conventions.

Hope this help !