fixed queue insertion bug