Bug fixes from interface upgrades

fixed various bugs related to recent interface upgrades, and one bug
for adding metadata to fields which have no existing metadata.