Fix nil handling