fixed version of thread safe queue