some refactoring for tests39-52