fixed foreign key retrieval