Fix a bug in RemoveDeadNodes where it would crash when its "optional"