added persistent session handling