fix bug: debug(exists) can result in infinite recursion