tests for smj and insert null case. fixed smj sort to work with duplicates