Fixed a writing bug