fix Set_Next() and Index_Kmp() functions