fix safari js bug