Bug fix

fix dist build
fix exception handling