Correcting queue logic