added code to reset count on replay