Fix write test