Will this fail if you pass in a full path with -agent- in it?  I could see this maybe happening although the trailing slash makes that unlikely.