bug fix for kmp