Fix agent status check