fix error stack not getting updated