Fixed bugs detected by Xcode 5.