fix nil sorting