Update sort_r; Fix linux compiler warnings