Fixes wrong scope for childrenCount.