Properly reorg fragment saved state on dataset change

fixes #2118
Merge pull request #316 from devrandom/fixes3

Bug - properly reorg fragment saved state on dataset change