Fixed residue_frequencies calculation and likelihood calculation