copied from SDSol