More fixes for write.tidy