bugfixes in write commands