Improve error handling

for checked cast and csv loader
Add installreformathook
Merge pull request #379 from bastih/master

Error reporting improvements.