fixed bug in db upgrade script