fixed exception handling with python 2.5, fixed #148