fix a bug in solver.py