add code to bypass the null pointer exception due to null  key retrieval
Merge pull request #1 from vidudaya/master

Well done vidudaya.