fixed the count problem when i moved it to the declare