Fixed some bugs with sqlite and migration.