fixed custom command without selection does not run

Modified according to patch set 1 (account for $j)

Change-Id: Ia9318e2d912e2b60e56a0ebf619d2686dea873be