Fixed legend crash.