fix exeption type in write method
Merge pull request #9 from Fastto/writeExeptionFix

fix exeption type in write method