CRM-13133 - also fix some notices and  pass-by reference warnings

----------------------------------------
* CRM-13133: Advanced Search is incorrectly including contacts removed from a group
  http://issues.civicrm.org/jira/browse/CRM-13133
Merge pull request #1948 from dlobo/CRM-13133

CRM-13133 - also fix some notices and  pass-by reference warnings