Added better error logging and some support for EnhancedClass.fields.