Improved stacktrace detection