fixed a bug on checking if there are too many colours