some basic cleaning.
fix session expiration check.