improves exceptions handling