ugly code, made only slightly less ugly by not swallowing the exception