fix write bug

fix two write bugs
Merge pull request #115 from zhangyaochun/master

fix write bug