'cards' referenced before assignment