Fixes caught by automatic python analyzer
Fix raise of errors