Fix empty results causing nans