Added log sync and fixed a few bugs. Also increased receive buffer size