add error handling in block handlers, fixes #45
Merge branch 'issue45'