fix bug for sudo solver; fix isvalid