Fix trivial bug and port back to python 2.7