Fix problems from Xcode analysis