fix issue with undeclared variable in large dataset runs