Take out side effect in getAttributes