The comparison being invalid is definitely a bug; if I didn't want sorted output, I wouldn't be sorting.