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

Removed unnecessary 'else' statement
Merge branch 'master' into 4.2