Issue 218 primary key dependency

Fixes issue #163 and issue #218