fix bug on setAttributes and add documentation