fixed queue empty check. now the queues work as a buffer.