fix exeption type in write method

in write method was used ReadException instead WriteException.
it is fixed