Fixed infinite recursion in some scenarios