fix bug in generate_compare