Bug fixes for unittest methods with older versions of python