numerous bug fixes including: file uplaod handling, better agent
connect/disconnect handling