Fixed a memory leak in dict