fixed Attributes function to make it allocate memory correctly