fix #2: added `aliasIndex` logic in local `expand` function