fix incorrect array index in db upgrade