Modified defer to match loop behaviors.