Bug fixes for centralization of DB code. Issue #1.