convert session to dict before pickling

Session was constantly being pickled without converting to dict as it
should be.

IGNORE - this patch tries to pickle lock objects creating its own problems