Is it a mistake?

The unmodified code causes a segment fault because of using num_of_bits instead of num_of_words.