Fix for memory corruption that should have shown itself earlier.