fix to release memory