Bug fix for database updates

Fix a bug in which database values could be inserted in an order that did not
match the column ordering.