fixed relational key handling for many_many and belongs_many_many