Fixed race condition - context pointer must be set before creating session.