Change save function to work in safari/firefox