added ctx.defer in example