fix array access beyond bounds when bits_size > 32