Fixed off-by-one issue in colour index