addagent

* fix compiler warnings
* fix static analyzer warnings