Improved stack trace error debug handling