Add avoiding NPE and add logging
Merge branch 'issue-nwbib-17-spatial-99' into merge_17-504