ensure medians indicies are integers before selection