Fixed a memory corruption bug.