bugs in unsafeWrite
bugs in unsafeWrite