fixed a bug when resizing the queue