Improved automatic association in a few special cases and fixed a bug in
setting functional residues when updating models.