Fixed issues with PIN handling