update the KL methods and fix a bug in Coverity Scan