Simplify by flushing cerr just in one place