Fix bug in empty-queue case.