Fix 'number of variables' and 'number of modes' fields for better perf.