mended the write.py

added a few corrections.