fixed bug involving deletion of pairlist elements, added tests for such
Merge branch '17-fixes' into 18