Fix logic error in ColorIndex, though it behaved properly