Fix intermittent Safari bug