memory.c bug fixed