Fixed infinite recurrence in import, made RefDB functions take optional dbtype argument for db constructors other than RefDB