Fixed a major file sending bug

* Fixed a bug that corrupted any files sent to the client... oops
* Other minor changes were made as well

This is a working edition. Still has only been tested on a localhost.