issue #59: verify result is valid before trying to use it.
Merge pull request #60 from Hiro-Nakamura/master

issue #59: verify result is valid before trying to use it.