fix program in case of exceptions