fixed bug with bit_count not being reset