tested and corrected db upgrade script