fix null-pointer exception when checking key fails.
Merge remote-tracking branch 'origin/master'