Fix upgrade script after db layer updates.

Signed-off-by: Norv <a.w.norv@gmail.com>
Small fixes for upgrade script.

Signed-off-by: Norv <a.w.norv@gmail.com>
Merge pull request #423 from norv/fixes

Fixes