Fixed bug in db upgrade for img.