parse inventory more flexibly to cope with the new layout