xcode stuff. Thread safety