Fix counter and syntax error