Fix build issue

Cobra svn:2966 (post 0.9.3) uses different method overload resolution
with better nil checking.

Some of these changes need to be merged into the 'master' branch to
address issue #42