Add more tests around file transfer integrity.
Little cleanups, bugfixes.