Fixed item being added to wrong end of collection

When previous item is null, a new item should be added to the beginning of a collection, or unshifted, rather than pushed to the end (vice-versa in reverse mode).