various fixes in agent