fixing agent logic