Fixes https://github.com/godotengine/godot/issues/34889 and https://github.com/godotengine/godot/issues/34889