fix incorrect agent type replacement