Fix some errors and try to optimize the cooccurrence scanner.