Detect circular calls

@bregenspan I just fixed the bug causing a stack overflow error. We didn't have a circular dependency actually, but skipped to detect deltemplates and delcalls, causing a bogus dataset to have at hand.
What do you think?