fixed mem_wrap.h (mainly)