fixed 32 vs 64 bit bug in rank fns when counting groups and ranks
add checks to verify we are initlized before executing top-level routines