Fix + add unit tests

Fix transaction log
Add number of PIN try left