fix sorting of appointments