Fix incorrect deletion of nodes.

- Fix node deletion function to properly reassign the "next node"
  pointer.