Fix the generator so it writes to the correct place
Add a test that regenerates and retests