Fixed bug with nothing in write()