Fix error capture location to include real stack trace