Agent: bugfixes