Fix memory corruption on low memory.