better error/resume handling