fixed tree expand/contract bugs (hopefully)