fix excpetion deprecation warnings in python 2.6 and newer