initialize the session earlier

If checkConfig fails the session object is needed for displaying the error template

cc @MTGap @karlitschek @DeepDiver1975