Adding ability to retain a stale value when generate function fails