Avoid bad memory access in fragment assignment

Assuming p is a fragment_position instance, the statement
p = p.head->rest;
was causing bad memory access when p.head was a unique pointer.
Since the "index" member was declared after the "head" member, "index"
was being assigned after "head", but the argument "index" had been
deallocated as a result of "head" assignment.
Merge pull request #142 from magicant/fix/bad_access_in_fragment_assignment

Avoid bad memory access in fragment assignment