better handling of dict used for attributes to prevent early dealloc of references