Fixes session path and various other minor problems in the agent