Partial fix for #77 via better exception handling