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.
Merge pull request #1 from mollison/column_fix

Bug fix for database updates