I added flush() above, so we won't lose any changes.