added compatibility for safari/firefox