Fix spec and tests threadsafe