bug fixed
add new function to count result