hack to avoid implementing unwind-protect