added global exception handling