Fixed bugs with primary key detection on user entity