Add agent binary code and minor fixes