Fix various bugs in color codes