fixed issue where non-public nested types were still serialized even if option was set not to