Fixed tyep conversion error in exception handling