Add chunk send and encryption fix (both untested)
Fix chunk sending (tested)