EZP-22146: Fixing problem with memory exhausting