Fixes NPE, and potentially preemptively address database down problems.