Fix import errors and test errors.