handling ties in basic statistics