fetch labels function