Fixed issue with NAs and sorts properly