added handling of cases where message is the same size as the buffer, fixed an issue with logging chunk order