fix bug of kmp