Fixing badly formatted searches