fix bug for color function