fixed the updating memory