Fixed the bug on agentstatus function call