Fixed isActive() to handle recursion better.