Smartcards repository and several bugs fixed