fixed a bug of memory allocator