Fixed a bug which caused an invalid number of colors used