Fix scoping and bubble up error on retry