Fix error on search where correct metadata was not being returned