added an if in function flush_bits that checks for that we don't fill a byte with all zeros when a byte hasn't been started