fixed some typos and other bugs in the agent