fixed a few port issues on agent side