repaired KW search/root-finding