catch more errors when invalid session cookie, thanks Luca