fix: avoid using freed memory