some hat support fixes, optimized bitset