little changes to count and random_in, also enabled more complex keys like  to be used by demux