fix the crash on resume when memory is cleaned