fixing bug with assigning colors