Always get node first from queue if it is a solution

The previous solution didn't work right. This one fixes that problem.