read/write wrote, but some errors. debuggn