Add more checks before using pointers