fixed clearmemory