reverted ugly workaround for unpickleable generator