Cleaning up
Fixed bugs in the DB upgrade script
Bug fixes