update the KL methods for robustness and fix a bug found in Coverity Scan
update for robustness
change for JSON issue
Merge pull request #2371 from yorkerlin/develop

update the KL methods for robustness and fix a bug found in Coverity Scan