fix recursive nesting