fixing the counting part