Fix length bug in write_ascii