Better catching of exceptions