Fixed memory limit issue