fixed handling of c->next and c->ptr, made them consistent