Fix logic when agent is broken.