fix logic error, expand code & comments #2041
Merge pull request #2071 from openscholar/2041-pin-timeout

fix logic error, expand code & comments #2041