Making sure the server can survive duplicated queues, and also fixing the situation where a duplciated queue would happen and queue optimization