Fixed a memory leak introduced in previous version.