fix some bugs in test cases as these do not follow updates and changes in test targets
fix some PEP8 errors