fixed crashes on empty queues