Fixes of bugs + APDU tracing