Fixed issue with memory management.