Bug fixing and code coverage

Reach 100% code coverage for Python 2.x and 3.x.