Fixed infinite recursion bug