fixed uninitialized legend