fix bug where no patients were returned