bug in variable name and sort output format