Capture stack traces in the export function too