fixed an error when primary key is not a composite key