fixed doctest
added tests