Run tests with python 2.6 and 3, and fix some bugs