fix compiler errors on FreeBSD Release 9.1
bugfix: cut the read buffer by one using '\0'
bugfix: uninitialized field