Fixing bugs in solver.c