Fixed problems with KMP implementation.
Some more fixing of KMP.