fix core bugs; no infinite recursion