tried to fix some memory leak issues which are caused by SAE