fixed logic error

was using incorrect index for selection