Small improvements to the write script.