Fix script for agent