fixed the bugs on iOS5+