fix php warnings, improve contact search