Bug fix, updated doctests