Fixed a memory leak introduced in the last commit