resolve a bug with max index of colorFactory