Fixed memory leak introduced in last commit