fix bug that sometimes it doesn't work well on ios