Fix bugs in token invalidation.
Fix code style.
Add comment.