updated to stop crashing in safari