bugfix: Fix the item inserting loop

There was a missing condition in the appending part of the insert method, which
made the loop keep appending new nodes even though the prefix string was already
empty.

Closes #6.