Fix bug in cartographer.infer, infer_equal