Added check for session existance in xhr