change dispatch_barrier_async to dispatch_barrier_sync