added some debug code to hunt the 'missing rows problem'