Fix bugs identified by Travis

Problems with exceptions that do not exist in python2
String formatting uses indices