1. fix test case passed on original code; 2. use count-by