make validation work when `write_attribute` is using

closes #74