Session and Template debug fix