fix high memory usage