refine the value count method