Xcode logic fix