fix flash message and session clearing