added check for null numtrees