bugfix: writepiece, see commit-log