fixed a bug about primary key