fix writing