Passing wrong agent index