Fixed a memory leak (thanks Hwidong Na!)