Adding ability to retain a stale value when generate function fails or t...

...imes out