Fix testcases failing in Python3

This fixes the remaining few testcases that failed under Python 3. With this, all test cases ran through just fine using Python 3.4 on Ubuntu 14.04.