fixed socket stream bugs.
some small changes to size calculation.
added note in _TODO
Added 'make debug' option.
fixed various compiler warnings