Add some more null-safe checks just in case