make queue_insertn more flexible

Yes, it's an API change, but I'm pretty sure that nobody
other than the solver itself uses queue_insertn.