more doctests and fixing