[FIX] Invalid session regeneration

Fixes a bug in the way session regeneration is handled