short i/o: fix calls to write to use xwrite or write_in_full