fixed run-time error when output non-ascii