fixed bug which made transmission of files impossible

and included a testcase to show it works.