fix for #3, make exception handling python 3 compatible