add compatibility for safari and hopefully ie9