solve memory problem