Fixing bug with threaded Core Data