better session handling, coded the error reporting to /error