Mongo NPE check

builds on #1327