Fix cauptureTreeGeneration