improved handling of subtypes; broke write code
fixed iterator and object creation