Fix docstring handling and tests