some optimizations for initializing trees