Correct some bugs when sharing a patient