fix performance issue on Python
fix stdin/stdout/stderr