handled null pointer
Handled null pointer exceptions
Merge remote-tracking branch 'origin/master'Merge with Pratheek's Mongo changes