Fixed bug in new counting method.

This bug was due to the classic R error of expecting a set of indices to have length greater than one.  When there is only one index, the matrix becomes a vector and things fall apart.  It seems to be fixed, but I haven't run it yet on all of the regions.