Fix bugs caused by Safari

Close #49