moved and tiny modifications on gen_labels.py