fix memory issue in test