Improve the handling of error stacks.