a little optimization to bitset and more robust test