Fix invalid pointers.