KMP Algorithm fix