Fix primary keys check