fixed mem_check function issue, done with ex11 lab4