check valid categories tree