fix writing bugs :-)