Add test for writing