fixe bug in generate_rules where we were only return the lk for the highest k