fix detection of recursive calls