make search work and other bug fixes