Fix some issues with nd statistics