Fixed numerous bugs/issues with the purge_records API call. In particular, when in XML mode, purge_records is completely broken in the original BrookLab version.