Add support for fields;  misc bugfixes