Merge "Fix a bug where device index is not skipped correct." into pi-dev