fix memoryerror