Handle nil values without crashing