Fixed label assignment bug