fix issue when primary keys other than id are defined