fix config loading and db upgrade