count bug fix

fixed a bug with count reading whole database