corrected global exception handling example