use writer for Serialize to test error paths