Fix the autogenerated metadata field counts

Fixes the metadata count problems noticed by @hflynn in #421.