Fixed legend wrapping as per #1641.