add compatibility for safari and hopefully ie9

tested and working in safari. no access to ie9 atm.