Changes to satisfy Xcode and prevent compiler warnings.
Fix up some concurrent access.