fixing mistake about leaf functions