fix some problem
add mem.h which contain some memory varables