testing smartcard functions and solving a bug