Fix an issue with invalid pointers