Fixed bug where write() method complains about argument type (with tests).