added mem leak fix on dict_set