Fixes wrong scope for childrenCount.

Fixes wrong scope of childrenCount.