Using threads to importa data from directories; bug fix