Fix some issues with the database update code.