Fixes wrong scope of childrenCount.