fixed compare and free testing and bugs