Fixed bugs in Cac authentication