added typecast to auto increment PK

fixes #3583