There is another bug in the wordfreq program: in the Buffer structure, in the add function, in the case when the array must grow, you set elts to a instead of a'. This would cause a subscript exception to be raised if a word longer than the initial size (64) was ever seen.