Better fix for outofmemoryexception