Fix counter not getting reset