Remove usage of deprecated write_attribute