fixed a memory leak affecting comparison