add code to bypass the null pointer exception due to null  key retrieval