an attempt to solve memory usage issue