Fixed #16. Changed bitstream_pack to write one byte at a time instead of 8 at a time to prevent writing to memory not explicitly allocated. Only affects some SPARSE configurations.