Fixing another bug with non-id primary keys

Pretty straightforward. Let me know if I overlooked something.