Fixed db upgrade script