fix mem issue