Made solveLinearDiophantine more stable.