More tests and bug fix for initLayerTrees