Fix confusion with order of fields, add tests for traversing a foreign key