fixed some bugs in CC validation code