fix error handling
Merge branch 'release-1.0.6'