fix ctx.related struct constrcution