Fix BitArray.length bug

Fixes a BitArray.length bug discovered during code review.