Fixed index out of bounds error if remote is empty.

Fixed index out of bounds error if remote is empty.