Repaired a bug with model generation which would prevent the primary key from being detected