Bug fixes

Error occurred when trying to add or replace a node at the first item in
the list.