fix bug of null reference.

improve stacktrace dump.