Additional fixes to upgrade DB handling