fixed addAttr logic