Agent instance becoming null during runtime

Hai All,
Iam setting and agent instance in env like this

agent agt;
sys_env env;
scoreboard sco;
sco = scoreboard :: type_id :: create("sco",this);
env = sys_env :: type_id :: create("sys_env",this);
agt = env.agt;
uvm_config_db #(agent)::set(this,"*","AGENT",agt);

and in my scoreboard iam getting like this

agent agt;
if(!uvm_config_db #(agent)::get(this,"*","AGENT",agt))begin
    `uvm_fatal("message","message")
end

and iam not seeing fatal error in build phase rather during runtime when i try to access an memory inside my agent in a runtime task iam seeing a null reference error for the agent instance
data = agt.mem.read(address);
Error-[NOA] Null object access
dv/env/scoreboard.sv, 1328
The object at dereference depth 1 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it

I do not understand what why you are doing things like this. You do not need any agent in the scoreboard and you have your agent in the env anyway.
But without seeing more code it is impossible to guide you.

Thanks For the reply,
It was referencing to null somewhere i had changed the handle pointing in connect phase and issue got resoved…