Fix some nil handling issues.