fixed #8, only gen cookie and set session when session is really modified