update checkwrite for issue #4074
Merge pull request #4084 from qunox/fixcheckwrite

update checkwrite for issue #4074