Fix nasty memory corruption crash.