changed some logic in exchangeAppointmentManager