session creation and basic error handling