fixed bugs in solver