change to fix generating too many leaves