bug fixes for db migration after refactor