Improve stack trace handling when json is off.
Fix stack trace handling.