Fix some strange behaviors when changing colors.