Solved the very vexing crash that for some reason only showed up on Windows.