fix for comparator memory leak
fixed merge