Fix id validness checking for Tree expand/collapse