queueing bugs and api domain

Fixed bugs in multi-thread queue
Added api domain as settable variable