Fix bug for min tree