Fix warnings and doc-tests