fixed import error, and threading error