need addtional type check to avoid SEGV; ref #2609
Merge branch 'master' into iij