Fix the failure case of inserting before a non-existent reference item. We need to insert it at the end just as we do on the Mac.