fixing implementation of GCD-threadsafeing