enhanced Write() and Read()