application fixed: headers sent after session modifications

Trying to fix the sessionmiddleware example