fix writing to command