Bug fix: flush buffers before forking.