Fix memory leaks and improper use of nil values in synchronized block.
Make BABitArray protocol to help ensure consistency between BABitArray and BASparseBitArray interfaces.