Fix bug with nested set generation