Fixed several bugs with visit saving and deletion.  Only unique patients
are returned in advanced search now.