fix a bug, add a lot of log to later remove, later clean up comparison function