fix color validity check