Added print statements in exception blocks