AUDIT ME - attempt to fix a bug that localsearch was running into.  Its either fixed incorrectly or other bugs remain.