corrected legend problem