safer OOM handling when importing from XML