Bugfix in inserting new Record

Fixed a fatal error in the calculation of the row-id of the new element.
Optimization of the table structure

Changes to the sqlite table structure.