Fix a bug in gen_cp_hashes