Correcting queue code