Corrected check_session and template files