working on global error handing