Add more null pointer checks.