refactored pickling of sessions
Merge pull request #494 from niphlod/fix/pickle_refactoring

refactored pickling of sessions