Fix null pointer exception when searching on data.