Bugfix in writeBulk & publishBulk