updated count function
fix