fixed bug in stack trace replacement