fixed pk issue when using a name other than id