Bugfix: handle expired sessions
Parameters and prototypes