resolve redirect_stdout issue, fix #6