Error handling and bit of write()