refactored set_nkf, replaced some calls to CLAMP_DIFF with assertions