Revert "removed arg check from which()"

This reverts commit b429d7226d6c8449399ee3b041d7385c1f1a11f4.