Fixes invalid session bug