flush stdout before calling stderr