Fixed bugs in cc code