BUGFIX passing input to temp variable works for extracting on larger datasets - obv not got to bottom of problem.