Check type of token as well.
Removed unnecessary 'else' statement
Merge pull request #3136 from melvinsh/patch-1

Removed unnecessary 'else' statement
Merge remote-tracking branch 'upstream/master'