better stdout capturing