Fixed null pointer exception on searching