fixed bug on count