fixed empty queue bug