Adding check for autoincrement keys

Not familiar with Perl, please double check.