fix prefixCount and add more tests