Fix unnecessary stacktrace generation