Use instanceof instead of detectInstance
Merge pull request #1150 from tchak/instanceof

Use instanceof instead of detectInstance