fixing the bug for stack allocator