Fixed shutdown of threads and pools. Fixed padding of uneven byte counts.