Fixed memory overflow