almost resolved the session availability issue in templates