Fix error and crash when importing apkgs with special characters