fix keyword count logic