fix nested structure