modified exception case to comply python 3.3