fix a bug in KMP

Signed-off-by: jonnyhsy <jonnyhsy@foxmail.com>