Fix python code in python 3.3 and fix tests.