Fix unittest failures with python 2.7