Add required imports, fix DefaultDict tests