added stats (#define COLLECT_STATS)