change variable name from text to label
fix bug when params[:format] is nil
fix bug when both label and format is specified