fix a bug that shell expansions will run twice