Fixed bug in occurrence statistics program.

Thanks to Szymon Grabowski for pointing out this bug.