fix for AS7-6408 and some small test refactoring/cleanup