fixed bug in count