fix invalid use of count