Revert "Revert "Revert "Fix bug when using safari."""

This reverts commit 827e85bda0207ed84a56691a2e3dce3a9bd05ff3.