fix foreign key lookup when there is more than one target model for
foreign keys