recreate db sessions to prevent errors

Quite a stupid fix to prevent errors dependent on preceeding errors, but should not slow down much.