fixed potential problem in Memory thread, still doesnt work