Fixed small issues.

Added set_buffer_end().

File transfer test now checks if pieces arrive correctly.