fixed subsitiution solver.