Fix check for same type
Merge pull request #1967 from wmtan/FixBugInTypeComparison

Fix check for same type