Fixes invalid session bug
Merge pull request #1557 from xisi/security-invalidsession-fix

[FIX] Invalid session regeneration