Fixed counter error

Fixed infinite loop due mistyping.