Fixed foreign_key and primary_key for many_to_many relationships.