fixed the bug that was causing invalid number of bits error