Fix some bugs on iOS 6