Fixed bug with agent first at beginning