Ensure writer is set if it doesn't exist (fixes #1)