fix stdout be closed when DEBUG