Fixed some bugs that made the solver incorrect.

1 job for master in 18 seconds (queued for 4 seconds)