add nicer exception handling