Fix code that searches stack trace for function call