Better error-handling in regenerate.