Fix tests, add option to print stats to stdout