check if there is a session instance before using it
add the session ID to the error message