Fixed memory issue by allocating vector specifically for labels