Fix sphinx documentation and tests